package org.dairy.farms.dao.hibernate;

import org.dairy.farms.dao.FeedTypeDAO;
import org.dairy.farms.dao.generic.AbstractDAOImpl;
import org.dairy.farms.model.FeedType;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: gduggira
 * Date: Jul 12, 2011
 * Time: 4:36:13 PM
 */
@Repository("feedTypeDao" )
public class FeedTypeDAOImpl extends AbstractDAOImpl<FeedType,Long> implements FeedTypeDAO {
    @Override
    public FeedType findByName(String feedTypeName) {
        List<FeedType> feedTypeList = basePersistence.findByProperty(FeedType.class,"name",feedTypeName);
        if(feedTypeList != null && feedTypeList.size()>=1){
            return feedTypeList.get(0);
        }
        return null;
    }
}
